package org.bioversityinternational.mgbms.model.domain;

// Generated 13 oct. 2011 12:11:05 by Hibernate Tools 3.4.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Order generated by hbm2java
 */
@Entity
@Table(name = "`Order`", schema = "dbo", catalog = "imgbms")
public class Order implements java.io.Serializable {

	private Integer id;
	private OrderStatus orderStatus;
	private Contact contact;
	private CentreType centreType;
	private String orderformnumber;
	private Date requestdate;
	private Date orderdate;
	private String orderobservation;
	private String studypurpose;
	private String acceptanceMethod;
	private String authorisedOfficialName;
	private String authorisedOfficialAddress;
	private String paymentMethod;
	private Set<AssOrderAccession> assOrderAccessions = new HashSet<AssOrderAccession>(
			0);
	private Set<Shipment> shipments = new HashSet<Shipment>(0);

	public Order() {
	}

	public Order(OrderStatus orderStatus, Contact contact,
			CentreType centreType, String acceptanceMethod,
			String authorisedOfficialName, String authorisedOfficialAddress) {
		this.orderStatus = orderStatus;
		this.contact = contact;
		this.centreType = centreType;
		this.acceptanceMethod = acceptanceMethod;
		this.authorisedOfficialName = authorisedOfficialName;
		this.authorisedOfficialAddress = authorisedOfficialAddress;
	}

	public Order(OrderStatus orderStatus, Contact contact,
			CentreType centreType, String orderformnumber, Date requestdate,
			Date orderdate, String orderobservation, String studypurpose,
			String acceptanceMethod, String authorisedOfficialName,
			String authorisedOfficialAddress, String paymentMethod,
			Set<AssOrderAccession> assOrderAccessions, Set<Shipment> shipments) {
		this.orderStatus = orderStatus;
		this.contact = contact;
		this.centreType = centreType;
		this.orderformnumber = orderformnumber;
		this.requestdate = requestdate;
		this.orderdate = orderdate;
		this.orderobservation = orderobservation;
		this.studypurpose = studypurpose;
		this.acceptanceMethod = acceptanceMethod;
		this.authorisedOfficialName = authorisedOfficialName;
		this.authorisedOfficialAddress = authorisedOfficialAddress;
		this.paymentMethod = paymentMethod;
		this.assOrderAccessions = assOrderAccessions;
		this.shipments = shipments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "status", nullable = false)
	public OrderStatus getOrderStatus() {
		return this.orderStatus;
	}

	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "contactId", nullable = false)
	public Contact getContact() {
		return this.contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "centreTypeId", nullable = false)
	public CentreType getCentreType() {
		return this.centreType;
	}

	public void setCentreType(CentreType centreType) {
		this.centreType = centreType;
	}

	@Column(name = "orderformnumber", length = 50)
	public String getOrderformnumber() {
		return this.orderformnumber;
	}

	public void setOrderformnumber(String orderformnumber) {
		this.orderformnumber = orderformnumber;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "requestdate", length = 23)
	public Date getRequestdate() {
		return this.requestdate;
	}

	public void setRequestdate(Date requestdate) {
		this.requestdate = requestdate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "orderdate", length = 23)
	public Date getOrderdate() {
		return this.orderdate;
	}

	public void setOrderdate(Date orderdate) {
		this.orderdate = orderdate;
	}

	@Column(name = "orderobservation", length = 50)
	public String getOrderobservation() {
		return this.orderobservation;
	}

	public void setOrderobservation(String orderobservation) {
		this.orderobservation = orderobservation;
	}

	@Column(name = "studypurpose", length = 50)
	public String getStudypurpose() {
		return this.studypurpose;
	}

	public void setStudypurpose(String studypurpose) {
		this.studypurpose = studypurpose;
	}

	@Column(name = "acceptanceMethod", nullable = false, length = 10)
	public String getAcceptanceMethod() {
		return this.acceptanceMethod;
	}

	public void setAcceptanceMethod(String acceptanceMethod) {
		this.acceptanceMethod = acceptanceMethod;
	}

	@Column(name = "authorisedOfficialName", nullable = false, length = 128)
	public String getAuthorisedOfficialName() {
		return this.authorisedOfficialName;
	}

	public void setAuthorisedOfficialName(String authorisedOfficialName) {
		this.authorisedOfficialName = authorisedOfficialName;
	}

	@Column(name = "authorisedOfficialAddress", nullable = false, length = 512)
	public String getAuthorisedOfficialAddress() {
		return this.authorisedOfficialAddress;
	}

	public void setAuthorisedOfficialAddress(String authorisedOfficialAddress) {
		this.authorisedOfficialAddress = authorisedOfficialAddress;
	}

	@Column(name = "paymentMethod", length = 50)
	public String getPaymentMethod() {
		return this.paymentMethod;
	}

	public void setPaymentMethod(String paymentMethod) {
		this.paymentMethod = paymentMethod;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "order")
	public Set<AssOrderAccession> getAssOrderAccessions() {
		return this.assOrderAccessions;
	}

	public void setAssOrderAccessions(Set<AssOrderAccession> assOrderAccessions) {
		this.assOrderAccessions = assOrderAccessions;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "AssOrderShipment", schema = "dbo", catalog = "imgbms", joinColumns = { @JoinColumn(name = "orderId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "shipmentId", nullable = false, updatable = false) })
	public Set<Shipment> getShipments() {
		return this.shipments;
	}

	public void setShipments(Set<Shipment> shipments) {
		this.shipments = shipments;
	}

}
